package exam.test;

import org.springframework.stereotype.Component;
@Component
public class SocketServer {


public  void socketstart()

    {
        SocketServerListenHandler server = new SocketServerListenHandler(7484);

        // 启动一个线程用来监听客户端连接
        Thread clientConnectThread = new Thread(() -> {
            server.listenClientConnect();
        });
        clientConnectThread.start();

        // 启动一个线程用来监听控制台输入并发送消息给客户端
        Thread consoleInputThread = new Thread(() -> {
            server.listenConsoleInput();
        });
        consoleInputThread.start();


    }



}